#ifndef PLAYSENCE_H
#define PLAYSENCE_H

#include <QMainWindow>
#include<QTimer>
#include"config.h"
#include"map.h"
#include<QPainter>
#include"heroplane.h"
#include<QKeyEvent>
#include<QPaintEvent>
#include"bullet.h"
#include"ennemyplane.h"
#include"friplane.h"
#include<bomb.h>
#include"midenemyplane.h"
#include<QLabel>
#include<QSound>
#include<QMovie>
#include"bossplane.h"
#include<udpclient.h>
#include<QThread>
#include<thread>

class PlaySence : public QMainWindow
{
    Q_OBJECT
public:
    explicit PlaySence(QWidget *parent = nullptr);
    QTimer  m_Timer;
    //通信
    void Socket();
    //启动游戏 用于启动定时器对象
    void  playGame();
    //更新坐标
    void  updatePosition();
    //绘图事件
    void  paintEvent(QPaintEvent  *event);
    //地图对象
    Map m_map;
    //我方战机对象
    HeroPlane m_hero;
    //重写键盘事件
    void keyPressEvent(QKeyEvent *event);
    //网格大小，移动步数
    int step=30;
    //敌机出场
    void  enemyToScene();
    //敌机数组
    EnnemyPlane  m_enemys[ENEMY_NUM];
    Midenemyplane m_midenemys[ENEMY_NUM];
    //敌机出场间隔记录
    int  m_recorder;
    int  m_midrecorder;
    //碰撞检测
    void  collisionDetection();
    //友方战机
    Friplane m_fri;
    //爆炸数组
    Bomb  m_bombs[BOMB_NUM];
    //中等敌机出场
    void midenemytosence();
    //是否到达出场信息
    bool Start;
    //是否到达中场信息
    bool Mid;
    //是否到达boss信息
    bool End;
    //分数
    QLabel *scorelab;
    QString score;
    //友军血量
    QLabel *plane1lab;
    QLabel *plane2lab;
    QString plane1;
    QString plane2;
    //boss血量
    QLabel *bosslab;
    QString bossblood;
    //GIF播放
    QMovie *movie;
    QLabel *movielab;
    //boss战机
    BossPlane bossplane;
    bool gamestart;
    UDPClient *cli;
private:


signals:

public slots:
};


#endif // PLAYSENCE_H
